<?php
//Ten file muon xuat ra de in
/*$v_recordtype_filter = $_SESSION['onegate_current_recordtype'];
if(isset($_REQUEST['hdn_recordtype_filter'])){
	$v_recordtype_filter = $_REQUEST['hdn_recordtype_filter'];
} */
$v_recordtype_filter = $arr_single_record[FK_RECORDTYPE];
$v_file_name = "mau_nhan_ho_so.htm";
$v_xml_str = $arr_single_record['C_RECEIVED_RECORD_XML_DATA'];
//echo 'v_recordtype_filter'.$v_recordtype_filter; exit;
//file chua cac the can thay the
$v_receipt_richtext_file = "../../template/".$v_recordtype_filter."/mau_nhan_ho_so.htm";
//echo htmlspecialchars($v_receipt_richtext_file);exit;
if (!file_exists($v_receipt_richtext_file)){
	$v_receipt_richtext_file = "../../template/mau_nhan_ho_so.htm";	
}
//echo htmlspecialchars($v_receipt_richtext_file);exit;
$v_receipt_xml_file = "../../xml/".$v_recordtype_filter."/mau_in_nhan_ho_so.xml";
if (file_exists($v_receipt_xml_file)){
	$v_receipt_xml_string = _read_file($v_receipt_xml_file);
}else{
	$v_receipt_xml_file = "../../xml/other/mau_in_nhan_ho_so.xml";
	$v_receipt_xml_string = _read_file($v_receipt_xml_file);
}
//echo htmlspecialchars($v_receipt_xml_file);exit;
if(($v_recordtype_filter == '007e') || ($v_recordtype_filter == '004')){
	@session_start();
	$_SESSION['v_record_id_print'] = $v_record_id;
}
$v_receipt_richtext_string = _read_file($v_receipt_richtext_file);
//echo htmlspecialchars($v_receipt_richtext_string);exit;
echo $v_richtext_output = Print_Receipt_From_XML($v_receipt_xml_string,$v_receipt_richtext_string,$v_xml_str,$arr_single_record);
//_write_file($v_file_name,$v_richtext_output);

//print_r($arr_single_record); exit;
?>
<!--<script language="javascript">
	window.location = "<?php echo $v_file_name;?>";
</script>-->